package se.jagvetintedu;

public class Problem1 {

	//	If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of these multiples is 23.
	//	Find the sum of all the multiples of 3 or 5 below 1000.

	public int sumNaturalNumbers(int start, int end, int[] multiples) {
		int sum = 0;
		for (int i = start; i < end; i++)
		{
			for (int j = 0; j < multiples.length; j++)
			{
				if (i % multiples[j] == 0)
				{
					sum += i;
					break;
				}
			}
		}

		return sum;
	}

	public static void main(String args[])
	{
		System.out.println("Project Euler, problem 1");
		
		int[] multiples = {3, 5};
		Problem1 solution = new Problem1();
		System.out.println("Sum of all multiples of 3 or 5 below 1000: " + solution.sumNaturalNumbers(1, 1000, multiples));
	}
}
